package com.ztgf.commodity.api.client;

import com.ztgf.commodity.models.service.ICommoditySpecificationCategoryRelationService;
import com.ztgf.commodity.models.vo.SpecificationCategoryVO;
import com.ztgf.common.constant.Result;
import com.ztgf.common.enums.CodeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * author: chenyu.wang
 * date: 2020-06-03 14:06
 * Description:
 */
@RestController
@RequestMapping("/api/commoditySpecificationCategoryRelation")
@Slf4j
@Api(value = "CommoditySpecificationCategoryRelationApiController", tags = "分类规格关系表接口")
public class CommoditySpecificationCategoryRelationApiController {

    @DubboReference
    private ICommoditySpecificationCategoryRelationService commoditySpecificationCategoryRelationService;

    @PostMapping(value = "/getSpecificationCategory")
    @ApiOperation(value = "根据分类id，查询关联规格信息，用于上传商品位置", notes = "根据分类id，查询关联规格信息，用于上传商品位置")
    public Result getSpecificationCategory(Long id, Long brandId,String filterName) {
        if (null == id || null == brandId) {
            return new Result<>(CodeEnum.FAIL_100002);
        } else {
            List<SpecificationCategoryVO> list = commoditySpecificationCategoryRelationService.getSpecificationCategory(id, brandId,filterName);
            return new Result<>(list);
        }
    }


}
